﻿using AutoRegistDependency.Attributes;
using Core;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Markup;

namespace HandyWpf.Extensions
{
    /// <summary>
    /// ValueConverter工厂类，项目中被注册的IValueConverter通过此类可以获取到容器内的实现
    /// </summary>
    [MarkupExtensionReturnType(typeof(IValueConverter))]
    public class ValueConverterProviderExtension : AbstractProviderExtension<IValueConverter>, IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return instance.Convert(value, targetType, parameter, culture);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return instance.ConvertBack(value, targetType, parameter, culture);
        }
    }
}
